package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.TReceiveDetailMapper;
import com.ruoyi.system.domain.TReceiveDetail;
import com.ruoyi.system.service.ITReceiveDetailService;

/**
 * 物资领用明细Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-12-22
 */
@Service
public class TReceiveDetailServiceImpl implements ITReceiveDetailService 
{
    @Autowired
    private TReceiveDetailMapper tReceiveDetailMapper;

    /**
     * 查询物资领用明细
     * 
     * @param id 物资领用明细主键
     * @return 物资领用明细
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public TReceiveDetail selectTReceiveDetailById(Long id)
    {
        return tReceiveDetailMapper.selectTReceiveDetailById(id);
    }

    /**
     * 查询物资领用明细列表
     * 
     * @param tReceiveDetail 物资领用明细
     * @return 物资领用明细
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public List<TReceiveDetail> selectTReceiveDetailList(TReceiveDetail tReceiveDetail)
    {
        return tReceiveDetailMapper.selectTReceiveDetailList(tReceiveDetail);
    }

    /**
     * 新增物资领用明细
     * 
     * @param tReceiveDetail 物资领用明细
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int insertTReceiveDetail(TReceiveDetail tReceiveDetail)
    {
        tReceiveDetail.setCreateTime(DateUtils.getNowDate());
        return tReceiveDetailMapper.insertTReceiveDetail(tReceiveDetail);
    }

    /**
     * 修改物资领用明细
     * 
     * @param tReceiveDetail 物资领用明细
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int updateTReceiveDetail(TReceiveDetail tReceiveDetail)
    {
        return tReceiveDetailMapper.updateTReceiveDetail(tReceiveDetail);
    }

    /**
     * 批量删除物资领用明细
     * 
     * @param ids 需要删除的物资领用明细主键
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int deleteTReceiveDetailByIds(Long[] ids)
    {
        return tReceiveDetailMapper.deleteTReceiveDetailByIds(ids);
    }

    /**
     * 删除物资领用明细信息
     * 
     * @param id 物资领用明细主键
     * @return 结果
     */
    @Override
    @DataSource(value = DataSourceType.MASTER)
    public int deleteTReceiveDetailById(Long id)
    {
        return tReceiveDetailMapper.deleteTReceiveDetailById(id);
    }
}
